<template>
	<view class="content">
		<swiper class="datu" :indicator-dots="false" :autoplay="true" :interval="5000" :duration="1000">
			<swiper-item v-for="item,index in list">
				<view class="swiper-item">
					<image :src="'../../static'+item.icon" mode="" style="width: 100%; height: 240px;"></image>
				</view>
			</swiper-item>
		</swiper>

		<swiper class="gongleng" :indicator-dots="false" :autoplay="false">
			<swiper-item>
				<uni-section title="功能列表">
					<uni-grid :column="5">
						<uni-grid-item v-for="(item,index) in typelist" v-if="index<=6" :index="item.id">
							<view class="grid-item">
								<image :src="'../../static'+item.icon" style="width: 35px;height: 35px;" mode="">
								</image>
								<text>{{item.typename}}</text>
							</view>
						</uni-grid-item>
					</uni-grid>
				</uni-section>
			</swiper-item>
			
		</swiper>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				comments: [],
				message: '',
				// 轮番图
				"list": [{
						"id": 1,
						"icon": "/images/school1.jpg"
					},
					{
						"id": 2,
						"icon": "/images/school2.jpg"
					},
					{
						"id": 3,
						"icon": "/images/school3.jpg"
					},
					{
						"id": 4,
						"icon": "/images/school4.jpg"
					}
				],
				//功能
				"typelist": [{
						"id": 1,
						"typename": "新闻",
						"icon": "/images/news.png"
					},
					{
						"id": 2,
						"typename": "公告",
						"icon": "/images/announcement.png"
					},
					{
						"id": 3,
						"typename": "同学",
						"icon": "/images/classmate.png"
					},
					{
						"id": 4,
						"typename": "电话",
						"icon": "/images/telephone.png"
					},
					{
						"id": 5,
						"typename": "留言",
						"icon": "/images/leaveword.png"
					}
				]
			}
		},

		onLoad() {

		},
		methods: {
			
			postMessage(e) {
				let data = {
					comment: this.message,
					foodId: this.data.id,
					postDate: new Date().toISOString().substring(0, 10),
					userId: uni.getStorageSync('userInfo').id
				}
				uni.request({
					url: 'http://localhost:8090/freshmenapp/message/list',
					method: 'POST',
					data: data,
					success: res => {
						console.log(res);
						if (res.data.success) {
							uni.showToast({
								title: '发表成功'
							});
							this.getCommentListTop5()
						} else {
							uni.showToast({
								title: '发表失败',
								icon: "error"
							});
						}
					},
					fail: () => {
						uni.showToast({
							title: '发表失败',
							icon: "error"
						});
					},
					complete: () => {}
				});
			}
		}
	}
</script>

<style>
	.container {
		padding: 0;
		font-size: 14px;
		line-height: 20px;
	}

	.datu {
		height: 150px;
	}

	.gongleng {
		height: 100vh;
	}

	.grid-item {
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		padding: 10px;
	}

	.ly {
		width: 20px;
		height: 20px;
		padding: 0 0 0 5px;
	}

	.neirong {
		height: 100vh;
		width: 100vw;
	}
</style>